﻿#ifndef CRUNTIMESETTING_H
#define CRUNTIMESETTING_H
#include <QString>
#include <vector>

namespace ss {

struct RunConfig
{
    // time span, miliseconds
    int      nLockSpan;
    bool     bShowSecond;
    bool     bShowDate;
    bool     bRunOnStartup;
    int      nFontSizeForTime;
    int      nFontSizeForDate;
    int      nFontSizeForSentence;
    QString  font;
    QString  sentence;
    std::vector<QString> vecComments;
    RunConfig()
    {
        // default 10 minutes
        nLockSpan            = 1000 * 10;
        bShowSecond          = true;
        bShowDate            = true;
        bRunOnStartup        = true;
        nFontSizeForTime     = 200;
        nFontSizeForDate     = 80;
        nFontSizeForSentence = 80;
        font                 = "微软雅黑";
    }
};

class CRuntimeSetting
{
public:
    static bool Initialize();
    static const RunConfig& GetConfig();
    static const RunConfig& GetPreviewConfig();

    static void SetTimeSpan(unsigned int seconds);
    static void SetConfig(bool bShowSecond, bool bShowDate, unsigned int nSeconds, bool bRunOnStartup, const QString& sentence);
    static void SetPreviewConfig(bool bShowSecond, bool bShowDate, const QString& sentence);


private:
    CRuntimeSetting();
    static void Update2File();
    static RunConfig s_config;
    static RunConfig s_previewConfig;
    static void SetRunOnStartupState(bool bRunOnStartup);

    static int  GetLockSpan();
    static bool IsShowSecond();
    static bool IsShowDate();
    static bool IsRunOnStartup();
};



}


#endif // CRUNTIMESETTING_H
